#include "moveserver.h"

void moveServer(){    
    server.on("/forward", HTTP_GET, [](AsyncWebServerRequest *request){
        moveForward();
        Serial.println("go forward.");
        request->send(200);
    });

    server.on("/forwardleft", HTTP_GET, [](AsyncWebServerRequest *request){
        moveForwardLeft();
        Serial.println("go forwardleft.");
        request->send(200);
    });

    server.on("/forwardright", HTTP_GET, [](AsyncWebServerRequest *request){
        moveForwardRight();
        Serial.println("go forwardright.");
        request->send(200);
    });

    server.on("/backwardleft", HTTP_GET, [](AsyncWebServerRequest *request){
        moveBackwardLeft();
        Serial.println("go backwardleft.");
        request->send(200);
    });

    server.on("/backwardright", HTTP_GET, [](AsyncWebServerRequest *request){
        moveBackwardRight();
        Serial.println("go backwardright.");
        request->send(200);
    });

    server.on("/backward", HTTP_GET, [](AsyncWebServerRequest *request){
        moveBackward();
        Serial.println("go backward.");
        request->send(200);
    });

    server.on("/left", HTTP_GET, [](AsyncWebServerRequest *request){
        moveLeft();
        Serial.println("go left.");
        request->send(200);
    });

    server.on("/right", HTTP_GET, [](AsyncWebServerRequest *request){
        moveRight();
        Serial.println("go right.");
        request->send(200);
    });

    server.on("/clockwise", HTTP_GET, [](AsyncWebServerRequest *request){
        clockwise();
        Serial.println("go clockwise.");
        request->send(200);
    });

    server.on("/anticlockwise", HTTP_GET, [](AsyncWebServerRequest *request){
        antiClockwise();
        Serial.println("go anticlockwise.");
        request->send(200);
    });

    server.on("/stop", HTTP_GET, [](AsyncWebServerRequest *request){
        stopMotors();
        Serial.println("stop .");
        request->send(200);
    });
}